#pragma once

/////////////////////////////////////////////////////////////////////////////
// CHexEdit window

class CEditCtrlEx : public CEdit
{
	// Construction
public:
	CEditCtrlEx();
	virtual ~CEditCtrlEx();

	void SetListener(CEditCtrlEx* pEdit);
	static CString FormatHex(PBYTE data, DWORD datalen);

protected:
	virtual void HandleListener() = 0;

private:
	void SetSelectState();
	void ClearSelectState();

protected:
	CEditCtrlEx* m_pEditListener;
	BOOL m_bState;
	int m_selStart;
	int m_selEnd;

	// Generated message map functions
protected:

	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	
	DECLARE_MESSAGE_MAP()
};


class CHexEditCtrl : public CEditCtrlEx
{
	// Construction
public:
	CHexEditCtrl() {}
	virtual ~CHexEditCtrl() {}

protected:
	virtual void HandleListener();

};

class CTextEditCtrl : public CEditCtrlEx
{
	// Construction
public:
	CTextEditCtrl() {}
	virtual ~CTextEditCtrl() {}

protected:
	virtual void HandleListener();

};